package com.cositas.dulces.lp.promo2012;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class BackendAction {

	public static void checkUser() {
		UserService userService = UserServiceFactory.getUserService();
		if (!userService.isUserLoggedIn()) {
			throw new RuntimeException("unauthorized");
		}
		User user = userService.getCurrentUser();
		if (!user.getEmail().equals("cositas.dulces.lp@gmail.com")) {
			throw new RuntimeException("unauthorized");
		}
	}

}
